package com.sharkburner.aeris.model;

import java.io.Serializable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.sharkburner.aeris.bean.UserBean;
import com.sharkburner.aeris.service.user.UserService;

@Component
@Scope("request")
public class UserModel implements Serializable {

	private static final long serialVersionUID = 1L;

	private UserBean user = new UserBean();
	private boolean validated;
	@Autowired
	private UserService userService;

	/**
	 * Create user
	 */
	public void save() {
		userService.save(user);
		validated = true;
	}

	public UserBean getUser() {
		return user;
	}

	public void setUser(UserBean user) {
		this.user = user;
	}

	public boolean isValidated() {
		return validated;
	}

	public void setValidated(boolean validated) {
		this.validated = validated;
	}

}
